//package com.shiyi.test;
//
//
//import com.alibaba.fastjson.JSON;
//import com.shiyi.common.ResponseResult;
//import com.shiyi.controller.PayParams;
//import com.shiyi.controller.PayServiceAbstract;
//import com.shiyi.dto.StaffSignTotalVO;
//import io.swagger.annotations.Api;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.kafka.clients.consumer.ConsumerRecord;
//import org.apache.kafka.clients.producer.ProducerRecord;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.kafka.annotation.KafkaListener;
//import org.springframework.kafka.core.KafkaTemplate;
//import org.springframework.kafka.support.Acknowledgment;
//import org.springframework.util.concurrent.ListenableFuture;
//import org.springframework.web.bind.annotation.*;
//
//import javax.security.auth.callback.Callback;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import java.util.Optional;
//import java.util.concurrent.ExecutionException;
//import java.util.logging.Logger;
//
//@RestController
//@Slf4j
//@RequestMapping("/myTest")
//@Api(tags = "我的测试接口11")
//@RequiredArgsConstructor
//public class testController {
//
//
//    @Autowired
//    KafkaTemplate kafkaTemplate;
//    @GetMapping(value = "/newBean")
//    public ResponseResult newBean() {
//        List<byte[]> list = new ArrayList<>();
//        String data = "hello world !!!";
//        ProducerRecord producerRecord = new ProducerRecord<>("topic",0,null,data);
//        kafkaTemplate.send(producerRecord);
//        ListenableFuture send = kafkaTemplate.send("test", data);
//        try {
//            send.get();
//        } catch (InterruptedException e) {
//            throw new RuntimeException(e);
//        } catch (ExecutionException e) {
//            throw new RuntimeException(e);
//        }
//        return ResponseResult.success();
//    }
//
//
//    @KafkaListener(topics = "test")
//    public void onMessage(ConsumerRecord<?, ?> record, Acknowledgment ack){
//        System.out.println("消费消息，record："+record.topic()+"-"+record.partition()+"-"+record.value());
//        Optional<Object> kafkaMassage = Optional.ofNullable(record.value());
//        if (kafkaMassage.isPresent()) {
//            Object o = kafkaMassage.get();
//            log.info("ConsumerController.groupId[gdzc-uims-iam]:" + o);
//            try {
////                Map<String, Object> res = JSON.parseObject(o.toString(), Map.class);
//                log.warn(o.toString());
//                ack.acknowledge();
//            } catch (Exception e) {
//                e.printStackTrace();
//                log.error("KafkaConsumer error", e.toString());
//            }
//
//        }
//    }
//
////    @KafkaListener(topics = "test", groupId = "am")
////    public void onMessage1(ConsumerRecord<?, ?> record){
////        System.out.println("消费消息111，record："+record.topic()+"-"+record.partition()+"-"+record.value());
////        Optional<Object> kafkaMassage = Optional.ofNullable(record.value());
////        if (kafkaMassage.isPresent()) {
////            Object o = kafkaMassage.get();
////            log.info("ConsumerController.groupId[gdzc-uims-iam]:" + o);
////            try {
//////                Map<String, Object> res = JSON.parseObject(o.toString(), Map.class);
////                log.warn(o.toString());
////            } catch (Exception e) {
////                e.printStackTrace();
////                log.error("KafkaConsumer error", e.toString());
////            }
////
////        }
////    }
//
//}
